package com.lw.entity.table;

import com.mybatisflex.core.query.QueryColumn;
import com.mybatisflex.core.table.TableDef;


/**
 *  表定义层。
 *
 * @author lw
 * @since 2025年04月29日 19:21:29
 */
public class TbNodeTableDef extends TableDef {

    private static final long serialVersionUID = 1L;

    /**
     * 
     */
    public static final TbNodeTableDef TB_NODE = new TbNodeTableDef();

    
    public final QueryColumn ID = new QueryColumn(this, "id");

    /**
     * 节点ip
     */
    public final QueryColumn IP = new QueryColumn(this, "ip");

    /**
     * 节点编码
     */
    public final QueryColumn CODE = new QueryColumn(this, "code");

    /**
     * 节点名称
     */
    public final QueryColumn NAME = new QueryColumn(this, "name");

    /**
     * 节点类型
     */
    public final QueryColumn TYPE = new QueryColumn(this, "type");

    /**
     * 服务状态 success：服务中，danger：告警
     */
    public final QueryColumn STATUS = new QueryColumn(this, "status");

    /**
     * 节点地址
     */
    public final QueryColumn ADDRESS = new QueryColumn(this, "address");

    /**
     * 内容
     */
    public final QueryColumn CONTENT = new QueryColumn(this, "content");

    /**
     * 流量 单位：KB
     */
    public final QueryColumn TRAFFIC = new QueryColumn(this, "traffic");

    /**
     * 磁盘剩余
     */
    public final QueryColumn DISK_FREE = new QueryColumn(this, "disk_free");

    /**
     * 硬盘描述
     */
    public final QueryColumn HARD_DESC = new QueryColumn(this, "hard_desc");

    /**
     * 磁盘共
     */
    public final QueryColumn DISK_TOTAL = new QueryColumn(this, "disk_total");

    /**
     * 告警次数
     */
    public final QueryColumn USER_COUNT = new QueryColumn(this, "user_count");

    /**
     * 服务描述
     */
    public final QueryColumn SERVICE_DESC = new QueryColumn(this, "service_desc");

    /**
     * 所有字段。
     */
    public final QueryColumn ALL_COLUMNS = new QueryColumn(this, "*");

    /**
     * 默认字段，不包含逻辑删除或者 large 等字段。
     */
    public final QueryColumn[] DEFAULT_COLUMNS = new QueryColumn[]{ID, NAME, CODE, TYPE, ADDRESS, IP, USER_COUNT, STATUS, SERVICE_DESC, CONTENT, HARD_DESC, DISK_TOTAL, DISK_FREE, TRAFFIC};

    public TbNodeTableDef() {
        super("", "tb_node");
    }

    private TbNodeTableDef(String schema, String name, String alisa) {
        super(schema, name, alisa);
    }

    public TbNodeTableDef as(String alias) {
        String key = getNameWithSchema() + "." + alias;
        return getCache(key, k -> new TbNodeTableDef("", "tb_node", alias));
    }

}
